package com.huawei.esdk.tp.domain.model;

import java.util.Date;
import java.util.List;

import com.huawei.esdk.platform.common.SDKErrorCode;
import com.huawei.esdk.platform.common.SDKResult;
import com.huawei.esdk.platform.common.exception.SDKException;
import com.huawei.esdk.tp.common.constants.TPConstant;
import com.huawei.esdk.tp.device.smc.IConferenceControlCapability;
import com.huawei.esdk.tp.device.smc.IConferenceManagerCapability;
import com.huawei.esdk.tp.domain.model.bean.ErrorInfo;

/**
 * 在会议中的会场
 * 
 * @author j00160659
 * 
 */

public class SiteInConference extends Site
{

    private String confId;

    private List<String> siteUris;

    private String from;

    private String confAccessCode;

    private Date beginTime;

    private String mcuUri;

    // 多mcu的情况，会场有多个accesscode
    private String accessCode;
    
    //是否支持直播
    private Integer isSupportLive;
    
    //是否支持录播
    private Integer isSupportRecord;
    
    //直播状态
    private Integer directBroadStatus;
    
    //录播状态
    private Integer recordBroadStatus;
    
    private String rate;

    // 是否闭音
    private Integer isMute;

    // 是否静音
    private Integer isQuiet;

    // 会场音量值
    private Integer volume;

    // 会场的视频源
    private String videoSource;
    
    //C30新增参数
    private Integer screens;
    
    private ErrorInfo callFailedReason;

    public Integer getIsMute()
    {
        return isMute;
    }

    public void setIsMute(Integer isMute)
    {
        this.isMute = isMute;
    }

    public Integer getIsQuiet()
    {
        return isQuiet;
    }

    public void setIsQuiet(Integer isQuiet)
    {
        this.isQuiet = isQuiet;
    }

    public Integer getVolume()
    {
        return volume;
    }

    public void setVolume(Integer volume)
    {
        this.volume = volume;
    }

    public String getVideoSource()
    {
        return videoSource;
    }

    public void setVideoSource(String videoSource)
    {
        this.videoSource = videoSource;
    }

    public SiteInConference()
    {

    }
    
    public SiteInConference(String uri)
    {
        super(uri);
    }

    public String getConfId()
    {
        return confId;
    }

    public void setConfId(String confId)
    {
        this.confId = confId;
    }

    public String getFrom()
    {
        return from;
    }

    public void setFrom(String from)
    {
        this.from = from;
    }

    public SiteInConference(String confId, String siteUri)
    {
        this.confId = confId;
        setUri(siteUri);
    }

    public List<String> getSiteUris()
    {
        return siteUris;
    }

    public void setSiteUris(List<String> siteUris)
    {
        this.siteUris = siteUris;
    }

    public String getConfAccessCode()
    {
        return confAccessCode;
    }

    public void setConfAccessCode(String confAccessCode)
    {
        this.confAccessCode = confAccessCode;
    }

    public Date getBeginTime()
    {
        if (null != beginTime)
        {
            return (Date)beginTime.clone();
        }
        else
        {
            return null;
        }
    }

    public void setBeginTime(Date beginTime)
    {
        if (null != beginTime)
        {
            this.beginTime = (Date)beginTime.clone();
        }
    }

    public String getMcuUri()
    {
        return mcuUri;
    }

    public void setMcuUri(String mcuUri)
    {
        this.mcuUri = mcuUri;
    }

    public String getAccessCode()
    {
        return accessCode;
    }

    public void setAccessCode(String accessCode)
    {
        this.accessCode = accessCode;
    }
    
    public Integer getIsSupportLive()
    {
        return isSupportLive;
    }

    public void setIsSupportLive(Integer isSupportLive)
    {
        this.isSupportLive = isSupportLive;
    }

    public Integer getIsSupportRecord()
    {
        return isSupportRecord;
    }

    public void setIsSupportRecord(Integer isSupportRecord)
    {
        this.isSupportRecord = isSupportRecord;
    }
    
    public Integer getDirectBroadStatus()
    {
        return directBroadStatus;
    }

    public void setDirectBroadStatus(Integer directBroadStatus)
    {
        this.directBroadStatus = directBroadStatus;
    }

    public Integer getRecordBroadStatus()
    {
        return recordBroadStatus;
    }

    public void setRecordBroadStatus(Integer recordBroadStatus)
    {
        this.recordBroadStatus = recordBroadStatus;
    }

    /**
     * @param siteUris
     * @return
     * @throws SDKException 
     * @see SMC:QueryConfSitesStatus
     */
    public SDKResult<List<SiteInConference>> querySitesStatusInConference(
            List<String> siteUris) throws SDKException
    {
        SDKResult<List<SiteInConference>> result = null;

        IConferenceManagerCapability confMgr = deviceManager
                .getDeviceServiceProxy(TPConstant.DEV_ID_SMC,
                        IConferenceManagerCapability.class);
        result = confMgr.queryConfSitesStatus(getConfId(), siteUris);

        return result;
    }
    
    public SDKResult<SiteInConference> queryBroadInfo() throws SDKException
    {
        SDKResult<SiteInConference> result = getTerminalService().queryBroadInfo();
        return result;
    }
    
    public SDKResult<SiteInConference> isSupportReocrd() throws SDKException
    {
        SDKResult<SiteInConference> result = getTerminalService().isSupportReocrd();
        return result; 
    }
    
    public SDKErrorCode setSitesMuteEx(boolean enable) throws SDKException
    {
        IConferenceControlCapability confMgr =
            deviceManager.getDeviceServiceProxy(TPConstant.DEV_ID_SMC,
                IConferenceControlCapability.class);
        
        SDKErrorCode result = confMgr.setSitesMuteEx(this.getConfId(), this.getSiteUris(), enable);
        
        return result;
    }

    public String getRate()
    {
        return rate;
    }

    public void setRate(String rate)
    {
        this.rate = rate;
    }
    

    public Integer getScreens()
    {
        return screens;
    }

    public void setScreens(Integer screens)
    {
        this.screens = screens;
    }

    public ErrorInfo getCallFailedReason()
    {
        return callFailedReason;
    }

    public void setCallFailedReason(ErrorInfo callFailedReason)
    {
        this.callFailedReason = callFailedReason;
    }

    public SDKErrorCode setSitesQuietEx(boolean enable) throws SDKException
    {
        IConferenceControlCapability confMgr =
            deviceManager.getDeviceServiceProxy(TPConstant.DEV_ID_SMC,
                IConferenceControlCapability.class);
        
        SDKErrorCode result = confMgr.setSitesQuietEx(this.getConfId(), this.getSiteUris(), enable);
        
        return result;
    }
}
